<?php
include 'Smarty.class.php';
include 'const.php';
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of error
 *
 * @author Qbejs
 */
class Error extends Smarty {
    
    private $error_type;
    private $error_msg;
    private $app_type;
    
    public function __construct($error_type,$error_msg) 
    {
        parent::Smarty();
        $this->setTemplateDir('/web/www.example.com/smarty/templates');
        $this->setCompileDir('/web/www.example.com/smarty/templates_c');
        $this->setCacheDir('/web/www.example.com/smarty/cache');
        $this->setConfigDir('/web/www.example.com/smarty/configs');
        $this->error_msg = $error_msg;
        $this->error_type = $error_type;
        $this->app_type = APP_VERSION;
    }
    
    public function show()
    {
        if ($this->app_type == 1)
        {
            $this->publicVersion();
        }
        else
        {
            $this->developmentVersion();
        }
    }
    
    private function publicVersion()
    {
        $this->assign('ErrorType', $this->error_type);
        $this->display($this->error_type."Error.tpl");
    }
    
    private function developmentVersion()
    {
        $this->assign('ErrorType', $this->error_type);
        if($this->error_type == "db")
        {
            
        }
        else
        {
            
        }
    }
}

?>
